package com.xej.seat.tag;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xej.seat.service.TagCacheService;
import com.xej.seat.vo.Customer;

/**
 * 机构标签
 * @author JiKe
 */
@Service
public class DefaultCustomerTag extends Tag {
	
	@Autowired
	private TagCacheService tagCacheService;
	
	@Override
	public double getWeight(Object obj) {
		Customer cus = (Customer) obj;
		double insPreCent = this.tagCacheService.getPerCent(cus.getInstName());
		double memberPreCent = "是".equals(cus.getIsMember()) ? 0.1 : 0 ;
		double chairmPreCent = "是".equals(cus.getIsChairm()) ? 0.1 : 0 ;
		double levelPreCent = (55 - cus.getCusLevel()) * 0.01;
		return cus.getAssets() * (1 + insPreCent + memberPreCent + chairmPreCent + levelPreCent);
	}
	
}
